package com.heima.behavior.controller.v1;

import com.heima.behavior.service.ApLikeBehaviorService;
import com.heima.behavior.service.ApReadBehaviorService;
import com.heima.behavior.service.ApUnLikeBehaviorService;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.behavior.dtos.UnLikesBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: behaviorController
 * Description:
 * date: 2023/8/24 0024 18:29
 *
 * @author zHan
 */
@RestController
@Slf4j
@RequestMapping("/api/v1")
@Api(tags = "app端行为接口")
public class BehaviorController {

    @Autowired
    private ApLikeBehaviorService apLikeBehaviorService;

    @Autowired
    private ApUnLikeBehaviorService apUnLikeBehaviorService;

    @Autowired
    private ApReadBehaviorService apReadBehaviorService;

    /**
     * 点赞
     * @param dto
     * @return
     */
    @PostMapping("/likes_behavior")
    @ApiOperation("点赞")
    public ResponseResult likesBehavior(@RequestBody LikesBehaviorDto dto) {
        return apLikeBehaviorService.likesBehavior(dto);
    }

    /**
     * 阅读
     * @param dto
     * @return
     */
    @PostMapping("/read_behavior")
    @ApiOperation("阅读")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto dto) {
        return apReadBehaviorService.readBehavior(dto);
    }

    /**
     * 不喜欢
     * @param dto
     * @return
     */
    @PostMapping("/un_likes_behavior")
    @ApiOperation("不喜欢")
    public ResponseResult unlikesBehavior(@RequestBody UnLikesBehaviorDto dto) {
        return apUnLikeBehaviorService.unlikesBehavior(dto);
    }


}
